﻿using System;
using System.Windows.Forms;

namespace CAGFIP.GUI
{
    public partial class JanelaPrincipal : Form
    {
        #region Fields

        private Panel telaAtual;

        private delegate void ChangeTelaCallback(Panel newTela);

        #endregion

        #region Constructor

        public JanelaPrincipal()
        {
            InitializeComponent();
        }

        #endregion

        #region Properties

        public Panel TelaAtual
        {
            set
            {
                if (this.InvokeRequired)
                    this.Invoke(new ChangeTelaCallback(ChangeTela), new object[] { value });
                else
                    ChangeTela(value);
            }
        }

        #endregion

        #region Methods

        private void ChangeTela(Panel newTela)
        {
            this.telaAtual = newTela;
            this.Controls.Clear();
            this.Controls.Add(newTela);
        }

        #endregion
    }
}
